Skip to content

fix(ui): handle undefined field admin components#17370

Merged
jacobsfletch merged 4 commits into
payloadcms:mainfrom
rasitakyol:codex/fix-undefined-admin-components
Jul 17, 2026
Merged

fix(ui): handle undefined field admin components#17370
jacobsfletch merged 4 commits into
payloadcms:mainfrom
rasitakyol:codex/fix-undefined-admin-components

Conversation

@rasitakyol

@rasitakyol rasitakyol commented Jul 16, 2026

Copy link
Copy Markdown
Contributor

What?

  • Guard the table-column custom label lookup when a field's optional admin.components value is explicitly undefined.
  • Add list-view E2E coverage for the crashing admin configuration.

Why?

Config transformers can preserve admin while clearing components with components: undefined. The property still passes the in check, so the subsequent 'Label' in serverField.admin.components operation throws and crashes the collection list.

How?

The custom label path now checks the components value before reading Label, matching the existing custom cell guard in the same function. The admin test collection reproduces the configuration, and the list-view E2E test verifies that the collection renders without a browser console error.

Fixes #17369

Testing

  • pnpm test:e2e admin__e2e__list-view --grep='should render a list view when field admin components are undefined' --workers=1
  • pnpm prettier --write packages/ui/src/providers/TableColumns/buildColumnState/index.tsx test/admin/collections/NoTimestamps.ts test/admin/e2e/list-view/e2e.spec.ts
  • pnpm eslint --flag v10_config_lookup_from_file --quiet packages/ui/src/providers/TableColumns/buildColumnState/index.tsx test/admin/collections/NoTimestamps.ts test/admin/e2e/list-view/e2e.spec.ts
  • pnpm build:ui

@rasitakyol
rasitakyol marked this pull request as ready for review July 16, 2026 21:01
@JarrodMFlesch
JarrodMFlesch enabled auto-merge (squash) July 17, 2026 13:23
@JarrodMFlesch
JarrodMFlesch disabled auto-merge July 17, 2026 14:43
SortColumn: () => null,
}))

describe('buildColumnState', () => {

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This test would be better written as e2e, given it crashes admin

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Ended up keeping this unit test, and using an additional e2e as smoke test

@jacobsfletch jacobsfletch left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thank you @rasitakyol! Would you be willing to back-port this against the 3.x branch?

@jacobsfletch
jacobsfletch merged commit 086ee18 into payloadcms:main Jul 17, 2026
338 of 342 checks passed
jacobsfletch added a commit that referenced this pull request Jul 17, 2026
Backport #17370 to the `3.x` branch.

---------

Co-authored-by: Jake Fletcher <jacobsfletch@gmail.com>
@rasitakyol
rasitakyol deleted the codex/fix-undefined-admin-components branch July 17, 2026 19:16
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Admin collection list crashes when a field has admin.components: undefined

2 participants